<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  // 第一种方式
  let fn = (num = 5) => {
    console.log(num);
  };

  // 第二种方法
  let f1 = (num) => {
    num = num || 10;
    console.log(num);
  };

  // 第三种方式
  let f2 = (num) => {
    if (num == undefined) {
      num = 19;
    };
    console.log(num);
  };
  fn();
  f1();
  f2();
</script>

</html>